<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/web/header.jsp"%>
<link rel="stylesheet" type="text/css"
	href="/B2CMall/web/base/css/login.css">
<title>注册页面</title>
</head>
<body>
	<form class="form center" onsubmit="return false">
		<div class="regist">
			<div class="regist_center">

				<div class="regist_main center">
					<div class="username">
						账&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;户:&nbsp;&nbsp;<input
							class="shurukuang" type="text" name="code" placeholder="请输入你的账户" /><span>请不要输入汉字</span>
					</div>
					<div class="username">
						姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名:&nbsp;&nbsp;<input
							class="shurukuang" type="text" name="name" placeholder="请填写你的姓名" /><span>请输入正确的姓名！</span>
					</div>
					<div class="username">
						密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码:&nbsp;&nbsp;<input
							class="shurukuang" type="pass" name="pass"
							placeholder="请输入你的密码" /><span>请输入6位以上字符</span>
					</div>
					<div class="username">
						<div class="left fl">
							验&nbsp;&nbsp;证&nbsp;&nbsp;码:&nbsp;&nbsp;<input class="yanzhengma"
								type="text" name="authcode" placeholder="请输入验证码" />
						</div>
						<div class="right fl">
							<img src="/B2CMall/AuthCodeController/auth.do"
								onclick='this.src="/B2CMall/AuthCodeController/auth.do?"+Math.random()'>
						</div>
						<div class="clear"></div>
					</div>
				</div>

				<div class="regist_submit">
					<input class="submit" type="submit" name="submit" value="立即注册"
						onclick="reg()">
				</div>
				<div class="regist_submit">
					<input class="submit" type="reset" name="reset" value="重置">
				</div>

			</div>
		</div>
	</form>

	<script type="text/javascript">
		function reg() {
			
			var code = $("input[name='code']").val();
			var name = $("input[name='name']").val();
			var pass = $("input[name='pass']").val();
			var authcode = $("input[name='authcode']").val();

			ajax({
				code : code,
				name : name,
				pass : pass,
				authcode : authcode
			}, '/user/reg.do', 'text', function(data) {
				if (data == "A") {
					layer.msg("注册成功", {
						time : 1000
					}, function() {
						toJsp("/web/front/login.jsp")
					});
				} else if (data == "F") {
					layer.msg("验证码错误", {
						time : 1000
					}, function() {
						toJsp("/web/front/reg.jsp")
					});
				} else if (data == "C") {
					layer.msg("帐号重复", {
						time : 1000
					}, function() {
						toJsp("/web/front/reg.jsp")
					});
				} else {
					layer.msg("注册失败", {
						time : 1000
					}, function() {
						toJsp("/web/front/reg.jsp")
					});
				}
			})
		}
	</script>


</body>
</html>